<template>
  
  <el-row class="panel-group" :gutter="40">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class='card-panel' @click="handleSetLineChartData('newVisitis')">
        <div class="card-panel-icon-wrapper icon-people">
          <img src="../../../assets/images/homeico1_03.png" alt="">
        </div>
        <div class="card-panel-description">
          <count-to class="card-panel-num" :startVal="0" :endVal="1088" :duration="2600"></count-to>
          <div class="card-panel-text">当前居民数</div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('messages')">
        <div class="card-panel-icon-wrapper icon-message">
          <img src="../../../assets/images/homeico2_06.png" alt="">
        </div>
        <div class="card-panel-description">
          <count-to class="card-panel-num" :startVal="0" :endVal="102" :duration="3000"></count-to>
          <div class="card-panel-text">本月新增人数</div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('purchases')">
        <div class="card-panel-icon-wrapper icon-money">
        <img src="../../../assets/images/homeico3_08.png" alt="">
        </div>
        <div class="card-panel-description">
          <count-to class="card-panel-num" :startVal="0" :endVal="899" :duration="3200"></count-to>
          <div class="card-panel-text">设备检测次数</div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('shoppings')">
        <div class="card-panel-icon-wrapper icon-shoppingCard">
       <img src="../../../assets/images/homeico4_11.png" alt="">
        </div>
        <div class="card-panel-description">
          <count-to class="card-panel-num" :startVal="0" :endVal="200" :duration="3600"></count-to>
          <div class="card-panel-text">设备总数</div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'
export default {
  components: {
    CountTo
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.panel-group {
  margin-top: 18px;
  .card-panel-col {
  }
  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);
    .card-panel-icon-wrapper {
      color: #fff;
    }
    .icon-people {
      background: #1cc09f;
    }
    .icon-message {
      background: #63a3df;
    }
    .icon-money {
      background: #fb5651;
    }
    .icon-shoppingCard {
      background: #e6a548;
    }
    .icon-people {
      color: #40c9c6;
      img{
        margin-top: -25px;
        margin-left: -40px;
      }
    }
    .icon-message {
      color: #36a3f7;
       img {
        margin-top: -25px;
        margin-left: -29px;
      }
    }
    .icon-money {
      color: #f4516c;
       img{
        margin-top: -31px;
        margin-left: -35px;
      }
    }
    .icon-shoppingCard {
      color: #34bfa3;
         img{
        margin-top: -31px;
        margin-left: -35px;
      }
    }
    .card-panel-icon-wrapper {
      float: left;
      height: 108px;
      min-width:108px;
      transition: all 0.38s ease-out;
      img {
        position: relative;
        top: 50%;
        left: 50%;
      }
    }
    .card-panel-icon {
      float: left;
      font-size: 48px;
    }
    .card-panel-description {
      font-weight: bold;
      text-align: center;
      padding: 1.3rem;
      height: 108px;
      .card-panel-text {
        line-height: 18px;
        color: #333;
        font-size: 14px;
        margin-bottom: 12px;
      }
      .card-panel-num {
        text-align: center;
        font-size: 40px;
        color: #8a8a8a;
      }
    }
  }
}
</style>
